package com.xk._01基础篇._08红黑树;

import com.xk._01基础篇._06二叉搜索树02.printer.BinaryTrees;
import com.xk._01基础篇._08红黑树.tree_rbTree.RBTree;

/**
 * @description:
 * @author: xu
 * @date: 2022/9/25 0:03
 */
public class Main {
    public static void main(String[] args) {
        test03();
    }

    static void test03(){
        Integer[] nums = new Integer[]{
                55,87,56,74,96,22,62,20,70,68,90,50
        };

        RBTree<Integer> rbTree = new RBTree<>();
        for (int i = 0; i < nums.length; i++) {
            rbTree.add(nums[i]);
            System.out.println("insert【" + nums[i] + "】");
            BinaryTrees.println(rbTree);
            System.out.println("=============================================");
        }

        for (int i = 0; i < nums.length; i++) {
            rbTree.remove(nums[i]);
            System.out.println("remove【" + nums[i] + "】");
            BinaryTrees.println(rbTree);
            System.out.println("=============================================");
        }
    }
}
